package co.edu.javeriana.aes.patrones.monopolio.cliente;

import co.edu.javeriana.aes.patrones.monopolio.cliente.chat.ChatJPanel;
import co.edu.javeriana.aes.patrones.monopolio.util.exception.MonopolyException;
import java.awt.BorderLayout;

/**
 *
 * @author gersua
 */
public class GamePanel extends AbstractPanel {

    private ChatJPanel chatJPanel;
    private BoardPanel boardPanel;

    /** Creates new form GamePanel */
    public GamePanel(MonopolyClient monopolyClient, ViewHandler viewHandler) throws MonopolyException {
        super(monopolyClient, viewHandler);
        chatJPanel = new ChatJPanel(monopolyClient, viewHandler);
        boardPanel = new BoardPanel(monopolyClient, viewHandler);
        initComponents();

        gameChatPanel.setLayout(new BorderLayout());
        gameChatPanel.add(chatJPanel, BorderLayout.CENTER);
        gameChatPanel.repaint();

//        gameBoardPanel.setLayout(new BorderLayout());
//        gameBoardPanel.add(boardPanel, BorderLayout.CENTER);
//        gameBoardPanel.repaint();

        repaint();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        gameBoardPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        gameChatPanel = new javax.swing.JPanel();
        gameStatPanel = new javax.swing.JPanel();

        setBackground(new java.awt.Color(0, 0, 0));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/javeriana/aes/patrones/monopolio/cliente/resources/NintendoMonopoly.jpg"))); // NOI18N

        org.jdesktop.layout.GroupLayout gameBoardPanelLayout = new org.jdesktop.layout.GroupLayout(gameBoardPanel);
        gameBoardPanel.setLayout(gameBoardPanelLayout);
        gameBoardPanelLayout.setHorizontalGroup(
            gameBoardPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jLabel1)
        );
        gameBoardPanelLayout.setVerticalGroup(
            gameBoardPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jLabel1)
        );

        org.jdesktop.layout.GroupLayout gameChatPanelLayout = new org.jdesktop.layout.GroupLayout(gameChatPanel);
        gameChatPanel.setLayout(gameChatPanelLayout);
        gameChatPanelLayout.setHorizontalGroup(
            gameChatPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 492, Short.MAX_VALUE)
        );
        gameChatPanelLayout.setVerticalGroup(
            gameChatPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 491, Short.MAX_VALUE)
        );

        gameStatPanel.setBackground(new java.awt.Color(0, 0, 0));

        org.jdesktop.layout.GroupLayout gameStatPanelLayout = new org.jdesktop.layout.GroupLayout(gameStatPanel);
        gameStatPanel.setLayout(gameStatPanelLayout);
        gameStatPanelLayout.setHorizontalGroup(
            gameStatPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 27, Short.MAX_VALUE)
        );
        gameStatPanelLayout.setVerticalGroup(
            gameStatPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 19, Short.MAX_VALUE)
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .add(gameBoardPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(gameStatPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(gameChatPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(gameBoardPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(gameChatPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(gameStatPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(36, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel gameBoardPanel;
    private javax.swing.JPanel gameChatPanel;
    private javax.swing.JPanel gameStatPanel;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}
